package ve.com.wayoyo.wuml_case.DibujoDiagramas;

import ve.com.wayoyo.wuml_case.Painter;
import ve.com.wayoyo.wuml_case.UserPref;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.graphics.Point;
import android.graphics.RectF;

public class CompEntidad extends Componente {
	
	private Paint _borderPaint = Painter.getInstancia().getDefaultBorderPaint();
	private RectF _border = new RectF();
	private String longestString;
	
	
	public CompEntidad(){
		if(UserPref.getInstancia().isUsingConvections() && Titulo.length() > 1){
			this.Titulo = Titulo.toUpperCase();
		}
		_centerPoint = new Point();
		Point punto = new Point();
		punto.x = 20;
		punto.y = 20;
		this.setAnchor(punto);
		_width = Painter.getInstancia().getTextPaint(false, 1).measureText(Titulo)+15;
		longestString = Titulo;
		_topAnchors = new BorderAnchors(4, Anchor, new Point((int)(Anchor.x+_width),Anchor.y));
		_bottomAnchors = new BorderAnchors(4,new Point(Anchor.x,(int)(Anchor.y+_height)) , new Point((int)(Anchor.x+_width),(int)(Anchor.y+_height)));
		_leftAnchors = new BorderAnchors(4, Anchor , new Point((int)(Anchor.x),(int)(Anchor.y+_height)));
		_rightAnchors = new BorderAnchors(4,new Point((int)(Anchor.x+_width),(int)(Anchor.y)) , new Point((int)(Anchor.x+_width),(int)(Anchor.y+_height)));
	}
	
	@Override
	public void Dibujar(Canvas c, boolean isFcoused, float globalScale, int offSetX, int offSetY) {	
		_border.set((Anchor.x+offSetX)*globalScale , (Anchor.y + offSetY)*globalScale, (Anchor.x+offSetX+_width)*globalScale,(Anchor.y + offSetY +_height)*globalScale );
		c.drawRoundRect(_border, 5*globalScale, 5*globalScale, Painter.getInstancia().getBorderPaint(_currentState));
	}

	@Override
	public boolean CalcularVisibilidad(int offSetX, int offSetY,
			float GlobalScale) {
		// TODO Auto-generated method stub
		return false;
	}

	@Override
	public boolean calcularTouch(Point touch) {
		// TODO Auto-generated method stub
		return false;
	}

	@Override
	public CompConector calcularTouchConectores(Point touch) {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public void actualizarAchorsPoints() {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void actualizarPuntoCentral() {
		// TODO Auto-generated method stub
		
	}

	@Override
	public String generarDOM() {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public String getConectorsDOM() {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public void calculoLongitud() {
		// TODO Auto-generated method stub
		
	}

}
